function [CompMatrix] = addMgNum_LiqAndSolid(CompMatrix,olivineKD)

numElements = size(CompMatrix,2); %% 7/18/14 currently 11
%[SUM MG#MELT MG#OLIV NAK#MELT]
for n=1:size(CompMatrix,1)
    CompMatrix(n,numElements+1) = nansum(CompMatrix(n,:));
    CompMatrix(n,numElements+2) = (CompMatrix(n,7)/40.311)./((CompMatrix(n,5)/71.846)+(CompMatrix(n,7)/40.311));
    CompMatrix(n,numElements+3) = 1/(olivineKD.*(1/ CompMatrix(n,numElements+2) - 1)+1);
    CompMatrix(n,numElements+4) = ( CompMatrix(n,9)+ CompMatrix(n,10))./(CompMatrix(n,8)+CompMatrix(n,9) +CompMatrix(n,10));
end

end




